<template>
<view>
<view v-for="(item, index) in list" :key="index" class="modle" v-if="list.length>0">
    <image class="modle_img" :src="item.head_image"></image>
    <view class="modle_title">{{item.nickname}}</view>
    <view @tap="follow" class="modle_btn" :data-id="item.fans_id" :data-index="index" v-if="item.is_follow==2&&type==1">关注</view>
    <view @tap="follow" class="modle_btn_no" :data-id="item.fans_id" :data-index="index" v-if="item.is_follow==1&&type==1">
        <image class="choose_view_modle_img" src="/static/pages/image/huxiang.png"></image>
    </view>
    <navigator class="choose_view" :url="'/pages/store/index?uid=' + item.fans_id">
        <view class="modle_btn" :data-id="item.fans_id" v-if="type==2">店铺</view>
    </navigator>
</view>
<block v-if="list.length<=0">
    <!--<import src="/pages/data_null/index.wxml"></import>-->
    <view>
        <block data-type="template" data-is="title" data-attr="title:'暂无查看数据'">
    <view class="zanwushuju_border">
        <image class="zanwushuju_border_img" src="/static/pages/image/none_message.png"></image>
        <view class="zanwushuju_border_title">{{'暂无收藏数据'}}</view>
    </view>
</block>
    </view>
</block>
</view>
</template>

<script>
var app = getApp();

export default {
  data() {
    return {
      page: 1,
      is_last: !1,
      list: [],
      type: 0
    };
  },

  components: {},
  props: {},
  onLoad: function (t) {
    var e = this;
    wx.setNavigationBarTitle({
      title: 1 == t.type ? "我的粉丝" : "我的关注"
    }), app.globalData.util.request({
      url: "entry/wxapp/Api",
      data: {
        m: "monai_market",
        r: "me.fans",
        uid: wx.getStorageSync("uid"),
        type: t.type
      },
      success: function (a) {
        a.data.data && e.setData({
          list: a.data.data,
          type: t.type
        });
      }
    });
  },
  onReachBottom: function () {
    var s = this;
    s.is_last || (console.log(s.is_last), app.globalData.util.request({
      url: "entry/wxapp/Api",
      data: {
        m: "monai_market",
        r: "me.fans",
        uid: wx.getStorageSync("uid"),
        page: s.page + 1,
        type: s.type
      },
      success: function (a) {
        a.data.data || (s.setData({
          is_last: !0
        }), wx.showToast({
          title: "没有更多数据了",
          icon: "success",
          duration: 2e3
        }));

        for (var t = s.list, e = 0; e < a.data.data.length; e++) t.push(a.data.data[e]);

        s.setData({
          list: t,
          page: s.page + 1
        });
      }
    }));
  },
  methods: {
    follow: function (e) {
      var s = this;
      app.globalData.util.request({
        url: "entry/wxapp/Api",
        data: {
          m: "monai_market",
          r: "me.follow",
          uid: wx.getStorageSync("uid"),
          type: 1,
          ucar_id: e.currentTarget.dataset.id
        },
        success: function (a) {
          var t = s.list;
          t[e.currentTarget.dataset.index].is_follow = a.data.data, s.setData({
            list: t
          });
        }
      });
    }
  }
};
</script>
<style>
@import "./fensi.css";
</style>